package ldh.im.client;

public class ResponseResult<T> {

    private int status;
    private String msg;
    private boolean success = false;
    private T data;

    public static ResponseResult build() {
        return new ResponseResult();
    }

    public ResponseResult() {
        this.success = true;
        this.status = 100;
    }

    public ResponseResult(int status, String msg) {
        this.status = status;
        this.msg = msg;
    }

    public ResponseResult(T data) {
        this.data = data;
        this.msg = "";
        this.success = true;
        this.status = 100;
    }

    public ResponseResult error(int status, String msg) {
        this.status = status;
        this.msg = msg;
        this.success = false;
        return this;
    }

    public ResponseResult success(T data) {
        this.success = true;
        this.msg = "";
        this.data = data;
        return this;
    }

    public int getStatus() {
        return status;
    }

    public String getMsg() {
        return msg;
    }

    public T getData() {
        return data;
    }

    public boolean isSuccess() {
        return success;
    }

}
